package com.atguigu.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.Objects;

@WebServlet("/s1")
public class UserServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 拿参数
        String name = req.getParameter("username");
        // 协议数据
        String info = "YES";
        if (Objects.equals(name, "ff")) {
            info = "NO";
        }
        resp.setHeader("Content-Type", "text/html");
        // 数据放入response
        resp.getWriter().write(info);
    }
}
